<?php
session_start();
$User_ID=$_SESSION['User_ID'];
?>
<?php

require_once("includes/database.php"); 




if (!empty($_POST['date_of_consultation_update']))
	{
	}
else
{
   $message = "Check your Inputs! All Fields are Required!";
	 echo "<script type='text/javascript'>alert('$message');window.location = 'thesis_vet_page.php';</script>";
     die( print_r( mysql_error(), true));
}
{	
$select_veterinarian_update_history = trim ($_POST['select_veterinarian_update_history}']);
$time_of_consultation_update = trim ($_POST['time_of_consultation_update']);
$date_of_consultation_update = trim ($_POST['date_of_consultation_update']);
$owner_User_ID_history = trim ($_POST['owner_User_ID_history']);
$pet_ID_history = trim ($_POST['pet_ID_history']);
$diagnosis = trim ($_POST['diagnosis']);
$prescription = trim ($_POST['prescription']);
$notes = trim ($_POST['notes']);
date_default_timezone_set ("Asia/Hong_Kong");
$timezone= date_default_timezone_get();
$date =date("h:i:sa");

$tsql="UPDATE consultation_history_db SET Diagnosis= '{$diagnosis}',Prescription= '{$prescription}',Notes= '{$notes}',Veterinarian= '{$select_veterinarian_update_history}'
WHERE Date= '{$date_of_consultation_update}<br>Time: {$time_of_consultation_update}' and Pet_ID= '{$pet_ID_history}' and Owner_User_ID= '{$owner_User_ID_history}'";

//sendEmail(getEmail($owner_User_ID_add),"Updated Immunization Date","From Petformance");

$data =  mysql_query($tsql,$con);

if( $data )
{
    /*echo "Connection established.\n";*/
	 $message = "Updating Consultation History Successful!";
	 echo "<script type='text/javascript'>alert('$message');window.location = 'thesis_vet_page.php?page=1&pet_id=';</script>";
}
else
{
   $message = "Updating Consultation History Failed!";
	 echo "<script type='text/javascript'>alert('$message');window.location = 'thesis_vet_page.php?page=1&pet_id=';</script>";
     die( print_r( mysql_error(), true));
}
}

?>